import React from 'react'
import style from "../css/Setting.module.css"
import { NavBar} from "antd-mobile";
import { useNavigate } from 'react-router-dom';
import { List } from 'antd-mobile'
import { Modal, Toast } from 'antd-mobile';
export default function Setting() {
    const navigate = useNavigate()
    const back = () => {
        navigate(-1);
      };
    // 消息设置
      function MessageSetting() {
        navigate('/my/setting/message')
      }
    // 自动回复
      function autoResponse() {
        navigate('/my/setting/autoresponse')
      }
      //系统权限
      function privilege() {
        navigate('/my/setting/privilege')
      }
      function securityCenter() {
        navigate('/my/setting/securityCenter')
      }
      function clearCache() {
        console.log(1111);
      }
  return (
    <>
     <NavBar onBack={back}>设置</NavBar>

     <List mode='card'>
     <List.Item onClick={MessageSetting}>消息设置</List.Item>  
     <List.Item onClick={autoResponse}>自动回复</List.Item>  
     <List.Item onClick={privilege}>系统权限</List.Item>  
     <List.Item onClick={securityCenter}>安全中心</List.Item>  
     <List.Item onClick={clearCache}>清理缓存</List.Item>  
     </List>
     <button className={style.tuichuBut} onClick={async()=>{
       const result = await Modal.confirm({
        content: '确定要退出用户?',
      })
      if (result) {
        Toast.show({ content: '退出成功', position: 'bottom' })
        localStorage.removeItem('token')
        localStorage.removeItem('user')
        navigate('/login/get')
      } else {
        Toast.show({ content: '点击了取消', position: 'bottom' })
      }
     }}>退出登录</button>
    </>
  )
}
